// 业务字段数据源配置
export const busiFieldFormSelectConfig = [
    <#list fieldData as item>
    <#assign fieldName = item.dbFieldName>
    <#assign dictOriginType = item.dictOriginType>
    <#assign dictTable = item.dictTable>
    <#assign dictField = item.dictField>
    <#assign dictText = item.dictText>
    <#if dictOriginType == "2">
        { dictTable: "${dictTable}", dictField: "${dictField}", dictText: "${dictText}", optionKey: "${fieldName}" },
    </#if>
    </#list>
]

export const busiFieldSearchSelectConfig = [
    <#list fieldData as item>
    <#assign fieldName = item.dbFieldName>
    <#assign dictField = item.dictField>
    <#assign fieldShowType = item.fieldShowType>
    <#assign dictText = item.dictText>
    <#if fieldShowType == "13">
        { isUser: true, dictField: "id", dictText: "id_name", optionKey: "${fieldName}" },
    </#if>
    <#if fieldShowType == "14">
        { isDept: true, dictField: "id", dictText: "dept_name", optionKey: "${fieldName}" },
    </#if>
    </#list>
]


export const operation = [
    {
        title: '操作',
        align: 'center',
        key: 'actions',
        width: 100,
        fixed: 'right',
        slots: {
            default: 'actions'
        }
    }
];
export const tableColumns = [
<#list fieldData as item>
    <#assign fieldShowName = item.fieldShowName>
    <#assign fieldName = item.dbFieldName>
    <#assign fieldShowType = item.fieldShowType>
    <#assign isQuery = item.isQuery>
    <#assign isShowList = item.isShowList>
    <#assign dictOriginType = item.dictOriginType>
    <#assign dictKey = item.dictKey>
    <#if isShowList == true && fieldShowType?has_content>
        <#switch fieldShowType>
        <#--            // 文本框-->
            <#case "1">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'text',
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 120,
                    formatter: ({cellValue, row}) => {
                        return cellValue || '--';
                    }
                },
                <#break>
            <#--                // 单选框-->
            <#case "2">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: <#if dictOriginType == "1">'dict'<#elseif dictOriginType == "2">'select'<#else>'select'</#if>,
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    minWidth: 120,
                    sortAble: 1,
                    options:{
                        <#if dictOriginType == "1"><#assign dictCode = item.dictField>dictCode: '${dictCode}',</#if>
                        <#if dictOriginType == "2">options: [],</#if>
                    },
                    formatter: ({cellValue, row}) => {
                        return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                    }
                },
                <#break>
            <#--                // 多选框-->
            <#case "3">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: <#if dictOriginType == "1">'multipleDict'<#elseif dictOriginType == "2">'multipleSelect'<#else>'select'</#if>,
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 150,
                    options: {
                        mode: "multiple",
                        <#if dictOriginType == "1"><#assign dictCode = item.dictField>dictCode: '${dictCode}',</#if>
                        <#if dictOriginType == "2">options: [],</#if>
                    },
                    formatter: ({cellValue, row}) => {
                                return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                    }
                },
                <#break>
             <#--                // 日期(yyyy-MM-dd)-->
            <#case "5">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'dateRange',
                    matchType: 'range',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 120,
                    formatter: ({cellValue, row}) => {
                            return cellValue || '--';
                    }
                },
                <#break>
            <#--                // 日期(yyyy)-->
            <#case "6">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'text',
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 100,
                    formatter: ({cellValue, row}) => {
                            return cellValue || '--';
                    }
                },
                <#break>
                <#case "7">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'dateTimeRange',
                    matchType: 'range',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 150,
                    formatter: ({cellValue, row}) => {
                            return cellValue || '--';
                    }
                },
            <#break>
            <#--                // 多行文本-->
            <#case "8">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'text',
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 150,
                    formatter: ({cellValue, row}) => {
                            return cellValue || '--';
                    }
                },
                <#break>
            <#--                // 下拉框-->
            <#case "10">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: <#if dictOriginType == "1">'dict'<#elseif dictOriginType == "2">'select'<#else>'select'</#if>,
                    matchType: 'equal',
                    options: {
                        <#if dictOriginType == "1"><#assign dictCode = item.dictField>dictCode: '${dictCode}',</#if>
                        <#if dictOriginType == "2">options: [],</#if>
                    },
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                     minWidth: 120,
                    formatter: ({cellValue, row}) => {
                        return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                    }
                },
                <#break>
            <#--                // 下拉多选-->
            <#case "11">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: <#if dictOriginType == "1">'multipleDict'<#elseif dictOriginType == "2">'multipleSelect'<#else>'select'</#if>,
                    matchType: 'contain',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 150,
                    options: {
                        mode: "multiple",
                        <#if dictOriginType == "1"><#assign dictCode = item.dictField>dictCode: '${dictCode}',</#if>
                        <#if dictOriginType == "2">options: [],</#if>
                    },
                    formatter: ({cellValue, row}) => {
                                return <#if dictOriginType == "1">row.${fieldName}_dictText<#elseif dictOriginType == "2">row.${fieldName}_realText<#else>cellValue</#if> || '--';
                    }
                },
                <#break>
            <#--                // 数值-->
            <#case "12">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    dataIndex: '${fieldName}',
                    key: '${fieldName}',
                    dataType: 'number',
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    sortAble: 1,
                    minWidth: 100,
                    formatter: ({cellValue, row}) => {
                            return cellValue;
                    }
                },
                <#break>
            <#--                // 人员选择-->
            <#case "13">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'select',
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    minWidth: 100,
                    sortAble: 1,
                    options: {
                        options:[]
                    },
                    formatter: ({cellValue, row}) => {
                            return row.${fieldName}_realText || '--';
                    }
                },
                <#break>
            <#--                // 部门选择-->
            <#case "14">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'select',
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                    minWidth: 120,
                    sortAble: 1,
                    options: {
                        options:[]
                    },
                    formatter: ({cellValue, row}) => {
                            return row.${fieldName}_realText || '--';
                    }
                },
                <#break>
                <#case "15">
                {
                    title: '${fieldShowName}',
                    align: 'center',
                    key: '${fieldName}',
                    dataType: 'userDict',
                    matchType: 'equal',
                    defaultSearchFlag: <#if isQuery>1<#else>0</#if>,
                    searchFlag: <#if isQuery>1<#else>0</#if>,
                     minWidth: 120,
                     sortAble: 1,
                    formatter: ({cellValue, row}) => {
                        return row.${fieldName}_dictText;
                    }
                },
                 <#break>
        </#switch>
    </#if>

</#list>
...operation,
];
